package com.irdstudio.smcenter.core.plugin.datajob;
/**
 * Java数据作业插件
 * 由具体的Java类来实现作业处理
 * @author guangming.li
 * @version 1.0
 * @date 2014-04-24
 */
public class JavaDataJobPlugin extends AbstractDataJobPlugin{

	@Override
	public boolean doExecuteJob(PluginJobConf jobConf) {
		boolean flag = false;
		this.logger.info("执行Java作业：" + jobConf.getJobName() + "...");
		try {
			IJavaJob job = (IJavaJob) Class.forName(jobConf.getJobImplement())
					.newInstance();
			flag = job.execute(context);
		} catch (InstantiationException e) {
			flag = false;
			context.szLastErrorMsg = e.getMessage();
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			flag = false;
			context.szLastErrorMsg = e.getMessage();
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			flag = false;
			context.szLastErrorMsg = e.getMessage();
			e.printStackTrace();
		} catch (Exception e) {
			flag = false;
			context.szLastErrorMsg = e.getMessage();
			e.printStackTrace();
		}
		return flag;
	}
}
